package com.spic.system.api.factory;

import com.spic.common.core.domain.R;
import com.spic.system.api.RemoteDictDataService;

import com.spic.system.api.domain.SysDictData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteDictDataFallbackFactory implements FallbackFactory<RemoteDictDataService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteDictDataFallbackFactory.class);

    @Override
    public RemoteDictDataService create(Throwable throwable)
    {
        log.error("修改参培人员调用失败:{}", throwable.getMessage());
        return new RemoteDictDataService(){

            @Override
            public R<Object> updateTrainPersoneel(String trainPersoneels) {
                return R.fail("修改参培人员调用失败:" + throwable.getMessage());
            }

            @Override
            public R<List<SysDictData>> getDictDataByDictType(String dictType) {
                return R.fail("根据字典类型查询字典数据信息调用失败:" + throwable.getMessage());
            }

        };

    }
}
